package com.Ajava1704.for设计模式.for观察者模式;

import java.util.Vector;

/**
 * 作者: LCG
 * 日期: 2020/2/14 15:38
 * 描述:
 */
public abstract class BeiGuanChaZheAbstract implements BeiGuanChaZheJieKou {

    private Vector<GuanChaZheJieKou> vector=new Vector<>();

    @Override
    public void register(GuanChaZheJieKou guanChengZhe) {
        vector.add(guanChengZhe);
    }

    @Override
    public void del(GuanChaZheJieKou guanChengZhe) {
       vector.remove(guanChengZhe);
    }

    @Override
    public void tongzhi() {

        vector.forEach(guanChaZhe->{
            guanChaZhe.chuli();
        });

    }

    @Override
    public void test() {

    }
}
